package com.bcsp.xml.ex1;




//import org.junit.jupiter.api.Test;

import com.bcsp.xml.ex1.Student;
import com.bcsp.xml.ex1.StudentDao;
import org.junit.Test;


import java.util.List;

public class TestStudent {

    StudentDao studentDao = new StudentDao();

    @Test
    public void test1() throws Exception {
        List<Student> students = studentDao.getAll();
        for (Student stu:students){
            System.out.println(stu);
        }
    }

    @Test
    public void test2(){
        Student student = studentDao.getOne(1);
        System.out.println(student);
    }

    @Test
    public void testAdd(){
        Student student = new Student();
        student.setId(9);
        student.setName("小明");
        student.setAge(26);
        student.setGender("boy");
        studentDao.add(student);
    }

    @Test
    public void testUpdate(){
        Student student = studentDao.getOne(2);
        student.setAge(student.getAge()+1);
        studentDao.update(student);
    }

    @Test
    public void testdelete(){
        studentDao.delete(9);
    }
}
